<cfparam default="none" name="url.api" />

<!--- AD Creation --->
<cfif url.api eq "ADCreation">
    <cfswitch expression="#CGI.REQUEST_METHOD#">
        <cfcase value="POST">
            <cfscript>
                c = CreateObject("component", session.RootDir & ".utilities.Creation").init();
                c.setStepID( FORM.StepID );
                if( c.Employee.getADUserID() EQ "" ){
                    writeoutput( SerializeJSON( c.createMailboxADAccount()) );
                }else{
                    writeOutput(SerializeJSON({STATUS = "Created", MESSAGE="<strong>Success</strong>", RESULT="#c.Employee.getADUserID()#"}, true));
                }
            </cfscript>
        </cfcase>
    </cfswitch>
</cfif>
<!--- AD Creation --->



<!--- HR Creation --->
<cfif url.api eq "HRCreation">
    <cfswitch expression="#CGI.REQUEST_METHOD#">
        <cfcase value="POST">            
            <cfscript>
                c = CreateObject("component", session.RootDir & ".utilities.Creation").init();
                c.setStepID( FORM.StepID );
                if( c.Employee.getHRPersonIdNo() EQ "" ){
                    writeoutput( SerializeJSON( c.createHRAccount()) );
                }else{
                    writeOutput(SerializeJSON({STATUS = "Created", MESSAGE="<strong>Success</strong>", RESULT="#c.Employee.getHRPersonIdNo()#"}, true));
                }
            </cfscript>
        </cfcase>
    </cfswitch>
</cfif>
<!--- HR Creation --->



<!--- Rosetta Creation --->
<cfif url.api eq "RosettaCreation">
    <cfswitch expression="#CGI.REQUEST_METHOD#">
        <cfcase value="POST">            
            <cfscript>
                c = CreateObject("component", session.RootDir & ".utilities.Creation").init();
                c.setStepID( FORM.StepID );
                if( c.Employee.getRosettaID() EQ "" ){
                    writeoutput( SerializeJSON( c.createRosettaAccount()) );
                }else{
                    writeOutput(SerializeJSON({STATUS = "Created", MESSAGE="<strong>Success</strong>", RESULT="#c.Employee.getRosettaID()#"}, true));
                }                
            </cfscript>
        </cfcase>
    </cfswitch>
</cfif>
<!--- AD Creation --->



<!--- NonSCF Master Creation --->
<cfif url.api eq "NonSCFMasterCreation">
    <cfswitch expression="#CGI.REQUEST_METHOD#">
        <cfcase value="POST">            
            <cfscript>
                c = CreateObject("component", session.RootDir & ".utilities.Creation").init();
                c.setStepID( FORM.StepID );
                writeoutput( SerializeJSON( c.createNonSCFMasterAccount()) );
            </cfscript>
        </cfcase>
    </cfswitch>
</cfif>
<!--- NonSCF Master Creation --->



<!--- Complete Creation --->
<cfif url.api eq "CompleteCreation">
    <cfswitch expression="#CGI.REQUEST_METHOD#">
        <cfcase value="POST">            
            <cfscript>
                c = CreateObject("component", session.RootDir & ".utilities.Creation").init();
                c.setStepID( FORM.StepID );
                //writeOutput(SerializeJSON({STATUS = "Created", MESSAGE="<strong>Success</strong>", RESULT="0"}, true));
                writeoutput( SerializeJSON( c.creationComplete()) );
            </cfscript>
        </cfcase>
    </cfswitch>
</cfif>
<!--- Complete Creation --->